#ifndef BTL_EXTRA_VIDEOSOURCE_VIDEOSOURCEUEYE
#define BTL_EXTRA_VIDEOSOURCE_VIDEOSOURCEUEYE


#include <btl/extra/VideoSource/VideoSource.hpp>
#include <ueye.h>


#define DEFAULT_UEYE_REQUESTED_NUM_BUFFERS 5


namespace btl
{
namespace extra
{
namespace videosource
{

class VideoSourceUEye : public VideoSource
{

   public:

      VideoSourceUEye(const char* iniFile = "", int deviceIndex = 0, int requestedNumBuffers = DEFAULT_UEYE_REQUESTED_NUM_BUFFERS);

      ~VideoSourceUEye();

      const ImageRegionConstRGB getNextFrame();

   protected:


      int _deviceIndex;

      int _numBuffers;

      HIDS _hCam;

      CAMINFO _camInfo;

      SENSORINFO _sensorInfo;

      struct FrameBuffer
      {
         char* pData;
         INT id;
         INT seqNum;
         INT size;
      };

      FrameBuffer* _frameBuffers;

      struct Exception : public VideoSource::Exception
      {
         Exception(const std::string& str) : VideoSource::Exception(str) {}
      };

};

} //namespace videosource
} //namespace extra
} //namespace btl


namespace btl
{
namespace extra
{

using videosource::VideoSourceUEye;

} //namespace extra
} //namespace btl


#endif //BTL_EXTRA_VIDEOSOURCE_VIDEOSOURCEUEYE
